import pc from 'picocolors';
import { version } from '@/utils';

const lang = {
  colon: ':',
  yes: 'Yes',
  no: 'No',
  enabled: 'Enabled',
  disabled: 'Disabled',
  fileExists: 'The file {0} already exist, overwrite?',
  filesExists: 'The files {0} already exist, overwrite?',
  recommend: pc.green('Recommended'),
  checkbox: {
    instructions: 'Press <space> to select, <a> to toggle all, <i> to invert selection, <Enter> to confirm'
  },
  exits: {
    message: 'Configuration file already exists. Overwrite?',
    description: {
      yes: 'The existing configuration file will be overwritten after setup',
      no: 'Will exit'
    }
  },
  basic: {
    title: 'Basics',
    standard: {
      message: 'Which standard do you plan to use?'
    },
    extension: {
      message: 'Extension for the configuration file?'
    }
  },
  commit: {
    title: 'Commit',
    message: 'Commit submission feature',
    lint: {
      message: 'commitlint standard',
      standalone: {
        message: `Detected ${pc.green('commitlint')} is installed. It's recommended to separate ${pc.green('commit type')} and ${pc.green(
          'commit scope'
        )} into individual files for unified configuration. Separate them?`
      },
      emoji: {
        message: 'Emoji expressions?'
      },
      lang: {
        message: `Language for explaining ${pc.green('commit type/scope')}?`,
        other: {
          message: 'Other?',
          check: {
            message: `Since ${pc.green('other languages')} will use ${pc.green('Google Translate')}, check connection status?`,
            success: `Connection successful(${pc.green('✔')}) . Which language would you like to translate to?`,
            fail: {
              message: `Connection failed(${pc.red('✖')}) . You can only choose a language from the list below.`,
              description: 'You can also change to any language you need in the configuration file later'
            }
          },
          translating: pc.green('! Translation Progress: ')
        },
        scope: {
          message: `${pc.green('commit scope')} enabled?`
        }
      }
    },
    content: {
      message: `Since the explanations for ${pc.green('commit type/scope')} are not in ${pc.blue('English')}, do you want to translate ${pc.yellow('each commit')} content into ${pc.blue(
        'English'
      )} using ${pc.blue('Google Translate')} for global readability?`,
      description: 'Of course, machine translation might not be accurate',
      confirm: {
        message: `To ensure translation accuracy, are you sure to write every ${pc.green('commit message')} in ${pc.green('{0}')}?`,
        description: 'You can also change to any language you need in the configuration file later',
        other: {
          message: 'Then, which language would you like to translate into English?'
        }
      }
    },
    save: {
      message: `Where do you want to save the ${pc.green('commit type/scope')}?`,
      success: {
        message: `${pc.green('✔')} Saved successfully. Path: {0}`
      },
      fail: {
        message: `Save failed. Save again?`
      }
    }
  },
  package: {
    title: 'Package Management',
    message: 'Package management feature',
    description: `Provides a ${pc.blue(
      'terminal interface menu'
    )} for package management with the following advantages:\n  1. Enhances efficiency and optimizes operations, user-friendly for beginners, just remember one command ${pc.blue(
      'cvlar'
    )};\n  2. Install, uninstall, update dependencies, view dependencies, view dependency update logs, etc.;\n  3. Manage scripts, alias commands, and select commands through the interface;\n  ...`,
    scripts: {
      select: {
        message: 'Select scripts to manage?',
        error: 'At least one must be selected'
      }
    },
    manager: {
      message: 'Package manager',
      type: {
        message: 'Type of manager?',
        auto: 'Auto-detect',
        description: 'Can also be modified later in the configuration file'
      },
      registry: {
        message: 'Dependency source?',
        description: 'Only affects dependencies installed through this tool, can also be modified later in the configuration file',
        auto: {
          message: 'Use the Default Source of the Package Manager',
          description: 'Can also be modified later in the configuration file'
        }
      },
      commands: {
        install: 'install',
        update: 'update',
        uninstall: 'uninstall',
        outdated: 'outdated',
        list: 'list',
        info: 'info',
        search: 'search',
        login: 'login',
        publish: 'publish'
      }
    }
  },
  version: {
    title: 'Version Control',
    message: 'Version management feature',
    description: 'Enables version upgrade functionality, allowing for version upgrades, specifying version numbers, reverting version numbers, etc.',
    validate: {
      message: 'Use default version number validation rules?',
      description: `Default rule: ${version.regex.toString()}\n      Examples:${version.example}`,
      change: {
        message: `Enter a new validation rule, or press ${pc.green('Enter')} to use the ${pc.yellow('default rule')}?`
      }
    },
    package: {
      message: `Modify the version number in package.json ${pc.green('(Recommended)')}?`
    }
  },
  changelog: {
    title: 'Logs',
    message: 'Generate changelog?',
    description: 'Enables changelog functionality, allowing for the generation of changelogs based on commit information',
    file: {
      message: 'Configure file storage rules?',
      limit: {
        message: 'How many version logs to record?',
        description: 'Default is 10, not 10 lines of logs, but 10 versions of logs'
      },
      save: {
        message: 'Directory to save logs?',
        description: 'Default is ./changelogs'
      }
    },
    translate: {
      message: 'Enable translation?',
      origin: {
        message: {
          auto: `${pc.green('✔')} ${pc.yellow('Commit messages')} will be written in ${pc.green('{0}')} and automatically translated into ${pc.green(
            'English'
          )}; since the log is generated from ${pc.yellow('commit messages')}, the original content of the log will be: ${pc.blue('{0}')}`,
          manual: `What is the original language of the log? That is, in what language are your ${pc.yellow('commit messages')} written?`
        },
        description: 'Default is zh-CN'
      },
      target: {
        message: `Target language?`,
        description: 'Default is English'
      }
    },
    template: {
      message: 'Configure template?',
      content: {
        message: 'Content template for each log entry (leave blank for default template)?'
      },
      logs: {
        title: {
          standard: {
            message: 'Standard log title template, supports `type`, `scope`, `date`, `time` variables (default template applies if left blank)'
          },
          other: {
            message: "Alternate log title template, used when logs can't be categorized by `commit type`"
          }
        },
        item: {
          message: 'Each log entry, content template, can use the variables `message`, `date`, `time`, `commitlink` (if left blank, the default template will be used).'
        },
        commitlink: {
          message: 'Do you add commit link at the end of each log? ',
          platforms: {
            message: 'Your code hosting platform? ',
            other: {
              message: 'Other address? ',
              input: {
                message: 'Please enter the complete url template'
              }
            }
          },
          author: 'Author',
          repository: 'Pepository name, supports `author`, `repository`, `id` variables'
        }
      }
    }
  },
  release: {
    title: 'GitHub Release Version',
    message: 'Automate release through GitHub Actions?',
    description: 'Enable GitHub Release feature for automatic version releases through GitHub Actions, requires Changelog functionality to be effective',
    subject: {
      message: 'Release page, tag version title template'
    },
    pushTagMessage: {
      message:
        'When creating a tag for the repository, logs are automatically generated. At this time, the tag will not include the new logs, so it is necessary to commit these changes to the repository. Do you want to set the corresponding configuration items?',
      description: {
        yes: 'Will separately set `type`, `scope`, `subject` configuration items',
        no: 'Will use the default configuration items'
      },
      type: {
        message: 'Choose commit type'
      },
      scope: {
        message: 'Choose commit scope'
      },
      subject: {
        message: 'Enter commit title, can use `tag` variable',
        description: 'For example: new version {{tag}}, which means: new version 1.0.0'
      }
    },
    lang: {
      subject: {
        message: 'Title used for Github Release when publishing multilingual content'
      },
      separator: {
        message: 'Separator for multilingual content in Github Release'
      }
    },
    poweredby: {
      message: `After automated release via ${pc.green('GitHub Actions')}, insert a link to ${pc.green('View All Logs')} at the end?`,
      description:
        "In the content of 'GitHub Release', at the end of each 'Release', add the following Markdown code:\n    ------------------------------------------------------------------------------------------------------------------------\n    - This [Changelog](/CHANGELOG.md), Powered by @kwooshung /[cvlar](https://github.com/kwooshung/cvlar/)\n    ------------------------------------------------------------------------------------------------------------------------\n    Here, CHANGELOG.md refers to the relative path of the 'Changelog' entry file in your repository\n    Reference: https://github.com/kwooshung/cvlar/releases"
    }
  },
  save: {
    title: 'Save',
    message: `Where would you like to save the ${pc.green('configuration file')}?`,
    filename: {
      message: 'What would you like the filename of the configuration file to be?'
    },
    success: {
      message: `${pc.green('✔')} Successfully saved. The path is: {0}`
    },
    fail: {
      message: `${pc.red('✖')} Failed to save ({0}/{1}). Would you like to try saving again?`,
      finally: `${pc.red('✖')} Save failed. You can manually create the configuration file according to the documentation. Here is the content of the configuration file:\n\n{0}`
    },
    ing: 'Saving...'
  }
};

export default lang;
